package com.tang.Proxy_3_28;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author tmh
 * @date 2024/3/28 19:42
 * @description
 */
public class ProxyStart {
    public static void main(String[] args) throws Exception {
        Class<?> clazz = Class.forName("com.tang.Proxy_3_28.User");
        //反射执行公共方法
        Method method = clazz.getDeclaredMethod("publicMethod");
        method.invoke(clazz.newInstance());
        Field privateField = clazz.getDeclaredField("age");
        privateField.setAccessible(true);
        int age = (int) privateField.get(clazz.newInstance());
        System.out.println("age->" + age);
    }
}
